import dotaClasses
import const
import buffs

class statsUpgrade(dotaClasses.ability):
	name = "Upgrade Stats"
	maxLevel = 10
	abilityClass = const.abilPassive

	@property
	def strength(self):
		return self.level * 2	

	@property
	def agility(self):
		return self.level * 2	

	@property
	def intel(self):
		return self.level * 2	
	webID = 'gnsu'

	image = "ability_stats_upgrade.png"

class precisionAura(dotaClasses.ability):
	name = "Precision Aura"
	maxLevel = 4
	abilityClass = const.abilPassive
	image = "drow_ranger_trueshot.png"
	webID = 'drts'
	aoe = 900

	@property
	def associatedBuffs(self):
		return [buffs.precisionAura(self.level - 1)]

class marksmanship(dotaClasses.ability):
	name = "Marksmanship"
	webID = 'drmk'
	maxLevel = 3
	abilityClass = const.abilPassive
	image = "drow_ranger_marksmanship.png"

	@property
	def agility(self):
		return (10 + 10 * self.level) * (1 + self.options['drmkd'].value)

	options = {'drmkd' : dotaClasses.booleanOption()}
	options['drmkd'].displayName = "Marksmanship: Double Bonus"
	def initOptions(self):
		self.options['drmkd'].value = False
		

class frostArrows(dotaClasses.ability):
	name = "Frost Arrows"
	webID = 'drfa'
	maxLevel = 4
	abilityClass = const.abilAutocast
	abilityType = const.abilityMagic
	image = "drow_ranger_frost_arrows.png"
	options = {'drfae' : dotaClasses.booleanOption()}
	options['drfae'].displayName = "Frost Arrows: Enabled"
	castRange = 625


class drowSilence(dotaClasses.ability):
	name = "Silence"
	webID = 'drsl'
	maxLevel = 4
	image = "drow_ranger_silence.png"
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	castRange = 900
	aoe = 300

class mantaMirrorImage(dotaClasses.ability):
	name = "Mirror Image"
	maxLevel = 1
	abilityClass = const.abilActive
	description = "Creates 2 images that deal 33% damage (28% for ranged) and take 350% damage (400% for ranged)\nHas a .1 second animation delay for which you are invulnerable\nLasts 20 seconds, costs 165 mana, and has a 35 second cooldown(50 second for ranged)"

	cooldown = 35
	manaCost = 165
	duration = 20

#class bloodPact(dotaClasses.ability):
#	name = "Blood Pact"
#	abilityClass = const.abilPassive
#	options = {'bpcc' : dotaClasses.numericalOption()}
#	options['bpcc'].maxValue = 255
#	options['bpcc'].displayName = "Blood Pact: Charges"

#	@property
#	def MPR(self):
#		return self.options['bpcc'].value

class cbBash(dotaClasses.ability):
	name = "Bash"
	abilityClass = const.abilPassive
	abilityType = const.abilityPhys
	@property
	def bash(self):
		try:
			if (self.associatedHero.weaponType == const.atkMelee):
				return dotaClasses.bash(0, .25, 1, 1, 1.4, 2)
			else:
				return dotaClasses.bash(0, .10, 1, 1, 1.4, 2)
		except:
			return dotaClasses.bash(0, .25, 1, 1, 1.4, 2)
	description = "Gives a chance to stun for 1.4 seconds.\n25% chance for melee, 10% chance for ranged.\nIgnores magic immunity."
	cooldown = 2
	duration = 1.4
	
class miniBash(dotaClasses.ability):
	bash = dotaClasses.bash(100, .35, const.dmgMagic, const.abilityMagic, .01, 0)
	name = "Mini-bash"
	abilityType = const.abilityMagic
	description = "Gives a 35% chance to deal 100 bonus magic damage and stun for .01 seconds. Does not go through magic immunity." 
	duration = .01
	damageType = const.dmgMagic

class trueStrike(dotaClasses.ability):
	name = "True Strike"
	abilityType = const.abilityPhys
	description = "Your attacks will never miss for any reason. Works against towers."

class overwhelm(dotaClasses.ability):
	description = "Stuns the target unit for 2 seconds."
	name = "Overwhelm"
	abilityType = const.abilityUni
	duration = 2
	abilityClass = const.abilActive
	manaCost = 150
	cooldown = 60
	castRange = 140
	abilityTarget = const.targetUnit

class damageReturn(dotaClasses.ability):
	name = "Damage Return"
	description = "Returns any damage you take (after reductions) to the unit that dealth the damage (you still take the damage as well)"
	damageType = const.dmgPure
	cooldown = 22
	manaCost = 25
	duration = 4.5
	abilityClass = const.abilActive
	
class avatar(dotaClasses.ability):
	abilityClass = const.abilActive
	name = "Avatar"
	description = "Grants magic immunity for 10/9/8/7/6/5 seconds. 80/75/70/65/60/55 second cooldown. Duration and CD decrease with each use down to a minimum of 5/55."

class arcticBlast(dotaClasses.ability):
	name = "Arctic Blast"
	description = "Emits a freezing wave around the caster.\nEnemies hit by the wave take 200 magical damage and have their movement speed slowed by 40% for 4 seconds."
	abilityClass = const.abilityActive
	cooldown = 30
	manaCost = 100
	aoe = 719
	damageType = const.dmgMagic
	abilityType = const.abilityMagic

class freezingAura(dotaClasses.ability):
	abilityClass = const.abilityPassive
	aoe = 1000
	abilityType = const.abilityMagic
	name = "Freezing Aura"
	description = "Reduces the attack speed of enemies by 30"

class spellBlock(dotaClasses.ability):
	abilityClass = const.abilPassive
	cooldown = 20
	name = "Spell Block"
	description = "Blocks targetted spells when not on cooldown"
	
class dominate(dotaClasses.ability):
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	abilityTarget = const.targetUnit
	cooldown = 60
	manacost = 75
	castRange = 700
	name = "Dominate"
	description = "Brings the target non-hero non-ancient under your control. Limit of one unit at a time."

class lifesteal(dotaClasses.ability):
	name = "Lifesteal"
	description = "Provies 15% lifesteal on attacks. Lifesteal is an orb but will stack with Skadi and Orb of Venom."
	affectsAncients = True

class hotdLifesteal(dotaClasses.ability):
	name = "Lifesteal"
	description = "Provies 15% lifesteal on attacks. Lifesteal is an orb but will stack with Skadi and Orb of Venom."
	affectsAncients = True

class momLifesteal(dotaClasses.ability):
	name = "Lifesteal"
	description = "Provies 17% lifesteal on attacks. Lifesteal is an orb but will stack with Skadi and Orb of Venom."
	affectsAncients = True

class momBerserk(dotaClasses.ability):
	name = "Berserk"
	description = "Gives +100 IAS and +30% Movespeed, but you take 30% extra damage."
	duration = 12
	manaCost = 25
	cooldown = 25

class lesserMaim(dotaClasses.ability):
	name = "Lesser Maim"
	description = "Gives a 15% chance on attack to slow movespeed and attack speed by 20% for 4 seconds."
	duration = 4
	abilityType = const.abilityUni
	abilityClass = const.abilPassive

class greaterMaim(dotaClasses.ability):
	name = "Greater Maim"
	description = "Gives a 15% chance on attack to slow movespeed and attack speed by 30% for 4 seconds."
	duration = 4
	abilityType = const.abilityUni
	abilityClass = const.abilPassive

class maelChainLightning(dotaClasses.ability):
	name = "Chain Lightning"
	description = "Gives a 25% chance on attack to release a Chain Lightning that hits 4 units, dealing 120 damage to each. Counts as an orb only on attack where it actually procs."
	abilityClass = const.abilPassive
	abilityType = const.abilityMagic
	damageType = const.dmgMagic

class diffusalPurge(dotaClasses.ability):
	name = "Purge" #purgegamers #yolo #swag
	description = "When cast on an ally or self, removes debuffs. When cast on an enemy, slows movespeed, removes debuffs, and deals massive damage if the target is a summoned unit."
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	damageType = const.dmgPhys
	abilityTarget = const.targetUnit
	cooldown = 8
	duration = 4
	castRange = 600

class feedback(dotaClasses.ability):
	maxlevel = 2
	name = "Feedback"
	description = "Causes your attacks to burn 20/36 of the target's mana and deal damage equal to the mana burned."
	abilityClass = const.abilPassive
	abilityType = const.abilityMagic
	damageType = const.dmgPhys

class disarm(dotaClasses.ability):
	name = "Disarm"
	description = "Disarms the target for 4.5 seconds (if target is ranged)/3 seconds (if target is melee)."
	manaCost = 100
	cooldown = 30
	castRange = 600
	abilityClass = const.abilActive
	abilityTarget = const.targetUnit
	abilityType = const.abilityMagic

class corruption(dotaClasses.ability):
	name = "Corruption"
	description = "Lowers the enemy's armor by 6"
	abilityClass = const.abilPassive
	abilityType = const.abilityPhys
	duration = 15
	affectsBuildings = True

class mjoChainLightning(dotaClasses.ability):
	name = "Chain Lightning"
	description = "Gives a 25% chance on attack to release a Chain Lightning that hits 4 units, dealing 160 damage to each. Counts as an orb only on attack where it actually procs."
	abilityClass = const.abilPassive
	abilityType = const.abilityMagic
	damageType = const.dmgMagic

class staticCharge(dotaClasses.ability):
	name = "Static Charge"
	description = "Places a shield on the targetted ally. When damaged, there is a 20% that the shield will release a chain lightning that will deal 200 magic damage to 3 targets. Has a proc cooldown of 1 second and cannot be stacked."
	abilityClass = const.abilActive
	abilityType = const.abilityUni
	abilityTarget = const.targetUnit
	damageType = const.dmgMagic
	duration = 20
	manaCost = 50
	cooldown = 35
	castRange = 600


class coldAttack(dotaClasses.ability):
	name = "Cold Attack"
	description = "Slows your target's attack speed by 20 and movespeed by 30%. Lasts 5 seconds for melee users, 3 seconds for ranged users. Counts as an orb but stacks with lifesteal and searing arrows."
	abilityClass = const.abilPassive
	abilityType = const.abilityUni

class satanicLifesteal(dotaClasses.ability):
	name = "Lifesteal"
	description = "Provies 25% lifesteal on attacks. Lifesteal is an orb but will stack with Skadi and Orb of Venom."
	affectsAncients = True

class unholyRage(dotaClasses.ability):
	name = "Unholy Rage"
	description = "Increases the lifesteal provided by the item by 175%. The lifesteal still counts as an orb."
	affectsAncients = True
	abilityClass = const.abilActive
	duration = 3.5
	cooldown = 35


class barrier(dotaClasses.ability):
	name = "Barrier"
	description = "Creates a barrier around nearby allied units that absorbs 400 spell damage (magic, mixed, or enhanced spell damage). Does not work on units that have been affected by Barrier in the last 50 seconds."
	cooldown = 60
	manaCost = 100
	duration = 10
	aoe = 500

class energyChargeStick(dotaClasses.ability):
	name = "Energy Charge"
	description = "Consumes all charges and restores 15 HP and mana for each charge."
	abilityClass = const.abilActive

class poisonAttack(dotaClasses.ability):
	name = "Posion attack"
	description = "Slows enemy movespeed by 4% (ranged user) or 12% (melee user). Counts as an orb but stacks with lifesteal and searing arrows."
	abilityClass = const.abilPassive
	duration = 4

class clarityActive(dotaClasses.ability):
	name = "Regenerate Mana"
	description = "Target yourself or an ally to restore 100 mana over 30 seconds. Effect ends if any damage is taken."
	abilityClass = const.abilActive
	abilityType = const.abilityUniversal
	abilityTarget = const.targetUnit
	duration = 30

class eatTree(dotaClasses.ability):
	name = "Eat Tree"
	description = "Eat a tree to restore 115 HP over 16 seconds."
	abilityClass = const.abilActive
	abilityTarget = const.targetTree
	duration = 16

class healthPotionActive(dotaClasses.ability):
	name = "Regenerate Health"
	description = "Restore 400 HP over 10 seconds. Taking damage will end the effect early. Can be used on yourself or an ally."
	abilityClass = const.abilActive
	abilityTarget = const.targetUnit
	abilityType = const.abilityUni
	duration = 10
	
class smokeOfDeceitActive(dotaClasses.ability):
	name = "Smoke of Deceit"
	description = "Makes all allies within the AoE invisible and grants 15% more movespeed. Affected units do not appear on the enemy minimap. If a unit gets within 1025 range of an enemy hero or tower, or if you attack, the buff is removed."
	duration = 40
	aoe = 1200
	cooldown = 90
	abilityClass = const.abilActive

class teleport(dotaClasses.ability):
	name = "Teleport"
	description = "Teleports you to any point within 525 range of an allied building. Destroys trees near the destination. Channel time is 3 seconds, plus 2 seconds if an ally recently teleported to an area, plus 1 more second for each additional ally. Shares cooldown with boots of travel."
	castRange = -1
	abilityTarget = const.targetPoint
	abilityClass = const.abilActive
	manaCost = 75
	cooldown = 65

class dust(dotaClasses.ability):
	name = "Dust of Appearance"
	description = "Places a buff on enemy units in range that prevents them from becoming invisible."
	aoe = 1050
	duration = 12
	manaCost = 5
	cooldown = 60
	abilityClass = const.abilActive

class summonAnimalCourier(dotaClasses.ability):
	name = "Summon Animal Courier"
	description = "Summons an Animal Courier to carry items for you."
	manaCost = 5
	abilityClass = const.abilActive

class summonFlyingCourier(dotaClasses.ability):
	name = "Summon Flying Courier"
	description = "Summons a Flying Courier to carry items for you."
	manaCost = 5
	abilityClass = const.abilActive

class placeWard(dotaClasses.ability):
	name = "Place Ward"
	description = "Places an Observer Ward to give sight of the surrounding area."
	duration = 360
	aoe = 1600
	abilityClass = const.abilActive

class placeRevWard(dotaClasses.ability):
	name = "Place Sentry Ward"
	description = "Places a Sentry Ward to give True Sight of the surrounding area. Has 70 vision range and 950 true sight."
	aoe = 950
	duration = 180
	abilityClass = const.abilActive

class drinkBottle(dotaClasses.ability):
	name = "Regenerate"
	description = "Restores 135 HP and 70 Mana over 3 seconds. Effect ends if you take damage. Uses one charge of the bottle. If the bottle contains a rune, the rune must be used before drinking the bottle."
	cooldown = .5
	abilityClass = const.abilActive
	duration = 3

class bottleRune(dotaClasses.ability):
	name = "Rune Capture"
	description = "Use the bottle to capture a rune. The rune will be used the next time you activate the bottle or 2 minutes after capturing the rune. The bottle cannot be shared when it contains a rune."
	abilityClass = const.abilActive

class qbDemolish(dotaClasses.ability):
	name = "Demolish"
	description = "Provides bonus damage against creeps. 32% for melee users, 12% for ranged users. Does not apply to denies."
	abilityClass = const.abilPassive

class qbTreeChop(dotaClasses.ability):
	name = "Tree Chop"
	description = "Destroys the target tree"
	abilityClass = const.abilActive
	abilityTarget = const.targetTree
	cooldown = 5
	castRange = 100

class pierce(dotaClasses.ability):
	name = "Pierce"
	description = "20% chance to deal 40 bonus damage."
	abilityClass = const.abilPassive
	bash = dotaClasses.bash(40, .2, 1, None, 0)

class ghostForm(dotaClasses.ability):
	name = "Ghost Form"
	description = "Makes your hero ethereal. While ethereal, you are physical immune but cannot attack and take 40% more damage from spells. Magic immunity overrides ghost form. Shares cooldown with Ethereal Blade. Using a TP scroll will cancel ghost form."
	abilityClass = const.abilActive
	duration = 4
	cooldown = 30

class fade(dotaClasses.ability):
	name = "Fade"
	description = "Upon activation, fades your hero out over 2.6 seconds. If you move, you will lose your invisibility."
	abilityClass = const.abilActive

class blink(dotaClasses.ability):
	name = "Blink"
	description = "Instantly teleports the caster to a nearby location. If cast outside the maximum range, you will only blink 4/5 the distance. Cannot be used if you have taken damage from an enemy player or roshan in the last 3 seconds."
	abilityClass = const.abilActive
	abilityTarget = const.targetPoint
	cooldown = 14
	manaCost = 75
	castRange = 1200

class sacrifice(dotaClasses.ability):
	name = "Sacrifice"
	description = "Sacrifices 150 HP to remporarily gain 150 Mana. Can give mana even if your mana is full. Mana not used in 10 seconds that is not used is lost."
	duration = 10
	cooldown = 30
	abilityClass = const.abilActive

class phase(dotaClasses.ability):
	name = "Phase"
	description = "Gain unitwalking and 12% movement speed until you use another ability or the duration expires."
	duration = 4
	cooldown = 8
	abilityClass = const.abilActive

class transmute(dotaClasses.ability):
	name = "Transmute"
	description = "Kill the target creep. You are given 190 gold and 2.5x the experience but the normal bounty of the creep is lost."
	abilityClass = const.abilActive
	cooldown = 100

class botTP(dotaClasses.ability):
	name = "Boots of Travel Teleport"
	description = "Teleport to target ally non-hero unit. Can teleport to structures. Has a 3 second channeling time and shares cooldown with TP scrolls."
	manaCost = 75
	cooldown = 60
	abilityClass = const.abilActive
	affectsBuildings = True

class bucklerActive(dotaClasses.ability):
	name = "Armor Bonus"
	description = "Gives +2 armor to nearby allied units. Lasts 5 seconds longer on non-hero units."
	duration = 25
	cooldown = 30
	aoe = 700
	abilityClass = const.abilActive

class soulRelease(dotaClasses.ability):
	name = "Soul Release"
	description = "Uses a charge to heal an ally for 400 HP over time (breaks if they take damage from players), or damages an enemy for 150 HP over time."
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	abilityTarget = const.targetUnit
	duration = 8
	cooldown = 10
	castRange = 950
	damageType = const.dmgHPR

class tranquilBootsHeal(dotaClasses.ability):
	name = "Rejuvenate"
	description = "Restores 250 HP over time. Breaks on player damage."
	abilityClass = const.abilActive
	duration = 20
	cooldown = 40

class valor(dotaClasses.ability):
	name = "Valor"
	description = "Reduces the armor of you and the target by 6."
	duration = 7
	cooldown = 7
	castRange = 800
	abilityClass = const.abilActive
	abilityTarget = const.targetUnit
	abilityType = const.abilityUni
	
class replenishMana(dotaClasses.ability):
	name = "Replenish Mana"
	description = "Restores 135 Mana to nearby allies"
	aoe = 600
	manaCost = 25
	cooldown = 55
	abilityClass = const.abilActive

class drumsActive(dotaClasses.ability):
	name = "Endurance"
	description = "Gives +10 attack speed and +10% movement speed to nearby player units."
	cooldown = 30
	aoe = 900
	duration = 6
	
class mekRestore(dotaClasses.ability):
	name = "Restore"
	description = "Gives +2 armor and heals 250 HP for nearby allies. Does not affect units that have been healed by a Mekansm in the last 25 seconds."
	abilityClass = const.abilActive
	aoe = 750
	duration = 25
	manaCost = 150
	cooldown = 45

class force(dotaClasses.ability):
	name = "Force"
	description = "Pushes an ally, enemy, or self 600 units over .3 seconds in the direction it is facing. Does not interrupt the target's actions. Cannot be used on units in a black hole or chronosphere."
	abilityClass = const.abilActive
	abilityTarget = const.targetUnit
	abilityType = const.abilityMagic
	manaCost = 25
	cooldown = 20
	castRange = 800

class magicWeakness(dotaClasses.ability):
	name = "Discord"
	description = "Applies a debuff on enemy units within the AoE, causing them to take 25% more magic damage."
	abilityClass = const.abilActive
	abilityTarget = const.targetPoint
	manaCost = 75
	cooldown = 30
	castRange = 1000
	aoe = 550
	duration = 20

class cyclone(dotaClasses.ability):
	name = "Cyclone"
	description = "Disables the target unit and makes it unable to act. Can target enemies or self but not allies."
	abilityTarget = const.targetUnit
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	duration = 2.5
	cooldown = 30
	castRange = 700
	manaCost = 75

class demonicSummoning(dotaClasses.ability):
	name = "Demonic Summoning"
	description = "Summons a necronomicon warror and archer."
	duration = 35
	manaCost = 50
	cooldown = 80
	abilityClass = const.abilActive

class energyBurst(dotaClasses.ability):
	name = "Energy Burst"
	description = "Deals 400/500/600/700/800 damage to the target enemy. Costs 180/160/140/120/100 mana, has a 35/30/25/20/15 second cooldown, and 600/650/700/750/800 cast range."
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	abilityTarget = const.targetUnit

class cripple(dotaClasses.ability):
	name = "Cripple"
	description = "Slows the target's movement speed by 60%."
	duration = 4
	manaCost = 50
	cooldown = 16
	castRange = 1200
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	abilityTarget = const.targetUnit

class orchidSoulBurn(dotaClasses.ability):
	name = "Soul Burn"
	description = "Silences the target unit and amplifies the damage it takes by 30%. Amplified damage is dealt at the end of the duration."
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	abilityTarget = const.targetUnit
	duration = 5
	manaCost = 100
	cooldown = 18
	castRange = 900
	damageType = const.dmgMagic

class ultimateUpgrade(dotaClasses.ability):
	name = "Ultimate Upgrade"
	description = "Upgrades the ultimate of certain heroes."
	abilityClass = const.abilPassive

class resetCooldowns(dotaClasses.ability):
	name = "Reset Cooldowns"
	description = "Resets the cooldowns of all your abilities and items."
	manaCost = 375
	cooldown = 160
	abilityClass = const.abilActive


class sheepStickHex(dotaClasses.ability):
	name = "Hex"
	description = "Turns a target unit into a sheep. Disables damage block and evasion, and reduces the target's base movespeed to 100. Instantly destroys illusions."
	duration = 3.5
	manaCost = 100
	cooldown = 35
	castRange = 800
	abilityClass = const.abilActive
	abilityType = const.abilityMagic
	abilityTarget = const.targetUnit

class shadowWalk(dotaClasses.ability):
	name = "Wind Walk"
	description = "Makes you invisible until the duration ends, or until you attack or use an ability. While invisible, you move 20% faster and can move through units. .3 second fade time. Attacking to break the invisibility will cause your attack to deal 150 bonus physical damage."
	duration = 12
	cooldown = 18
	manaCost = 75
	abilityType = const.abilityActive

class bfuryCleave(dotaClasses.ability):
	name = "Cleave"
	description = "Causes your attacks to cleave 35% of your damage (calculated before most reductions such as armor) in an AoE with your hero at the edge. Only works on melee units."
	aoe = 225
	damageType = const.dmgEnhHero

class etherBlast(dotaClasses.ability):
	name = "Ether Blast"
	description = "Converts you and the target to ethereal form. If the target is an enemy, it is also slowed by 80% and takes 75 + 2 times your primary attribute as magic damage. Shares cooldown with ghost scepter."
	manaCost = 150
	cooldown = 30
	castRange = 800
	abilityTarget = const.targetUnit
	abilityType = const.abilityMagic
	abilityClass = const.abilActive
	duration = 3

class radiBurn(dotaClasses.ability):
	name = "Burn Damage"
	description = "Deals 45 magic damage per second to nearby enemies when toggled on."
	abilityClass = const.abilToggle
	aoe = 650

class trueSight(dotaClasses.ability):
	name = "True Sight"
	description = "Gives true sight. Disabled while on courier."
	abilityClass = const.abilPassive
	




abilList = {}


for objName in dir():
	obj = vars()[objName]
	try:
		if obj.__bases__[0] == dotaClasses.ability:
			abilList[obj.webID] = obj
	except:
		pass
